<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="/websrc/page/common/jsloader.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%String baseUrl = request.getContextPath();%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JStar</title>
<script type="text/javascript">
		$(document).ready(function(){
			Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
			Ext.QuickTips.init();

			// 头部
			JStar.headerPanel = new Ext.Panel({
				region: 'north',
	            height: 40,
	            border: false,
	            margins: '0 0 0 5',
	            bodyStyle: 'background-color:transparent;',
	            autoLoad:{url:'<%=baseUrl %>/websrc/page/common/header.jsp',scripts:true,nocache:true}
	        });

			// 菜单面板
			JStar.menuPanel = new Ext.Panel({
				region: 'west',
                title: '主菜单',
                split: true,
                width: 240,
                minSize: 175,
                maxSize: 400,
                collapsible: true,
                margins: '0',
                layout:'accordion',
                layoutConfig: {
                    animate: true
                },
				listeners: {collapse: function(){JStar.resizeActiveTab();}}
			});
			
			// 系统菜单
			if(true){
				// 参数
				var param = {};
				param.baseUrl = '<%=baseUrl%>';
				param.role = '2';
				// 系统菜单
				var systemAccordion = Menu.getSystemAccordion(param);
				JStar.menuPanel.add(systemAccordion);
			}
			
			// tab主面板
			JStar.tabPanel = new Ext.TabPanel({
				id: 'mainTabPanel',
				region: 'center',
                deferredRender: false,
                activeTab: 0,
                enableTabScroll: true,
                plugins: new Ext.ux.TabCloseMenu({
                	closeTabText: '关闭标签页',
                	closeOtherTabsText: '关闭其他标签页',
                	closeAllTabsText: '关闭所有标签页'
	            }),
                items: [{
                    id: 1,
                    title: '我的主页',
                    iconCls: 'house'
                }],
				listeners: {
					tabchange: function(){
									JStar.resizeActiveTab();
									document.title = JStar.tabPanel.getActiveTab().title + ' - JStar';
								}
					}
            });
			
			// 初期化页面Layout
			var viewport = new Ext.Viewport({
	            layout: 'border',
	            items: [JStar.headerPanel, JStar.menuPanel, JStar.tabPanel]
			});
			var oTime;
			window.onresize = function() {    
				if (oTime){   
					 clearTimeout(oTime);   
				}
				oTime = setTimeout(function(){
					// 重新设置tab页尺寸
					JStar.resizeActiveTab();
					// 设置上传窗口最小化后按钮的位置
					var left = $(window).width() - 150;
					var top = $(window).height() - 60;
					$("#minUploadWinDiv").css("left", left);
					$("#minUploadWinDiv").css("top", top);
				}, 200); //延迟200毫秒执行
			};

			// 初期化上传窗口最小后后的按钮
    	    JStar.initMinUploadWinBtn('minUploadWinDiv');
		});
	</script>
</head>
<body>
	<!-- 菜单用Div -->
	<div id="menuDiv" class="x-hide-display">
       <div id="homeAccordionDiv"></div>
       <div id="todoAccordionDiv"></div>
       <div id="noteAccordionDiv"></div>
       <div id="feedAccordionDiv"></div>
       <div id="pictureAccordionDiv"></div>
       <div id="documentAccordionDiv"></div>
       <div id="accountAccordionDiv"></div>
       <div id="systemAccordionDiv"></div>
    </div>
    <!-- 上传按钮最小化用Div -->
    <div id="minUploadWinDiv"></div>
    <!-- 锁定用Div -->
    <div id="lockDiv" class="x-border-layout-ct" style="position:absolute;width:100%;height:100%;z-index:9999;display:none;">
    	<table id="logo-table">
			<tr>
				<td align="center" height="40"><a href="<%=baseUrl %>"><img src="#"></img></a></td>
			</tr>
		</table>
    	<div id="lockWindowDiv" style="margin-top:65px;"></div>
    </div>

</body>
</html>